package jpa.factory;

import jpa.dao.DAO;
import jpa.model.Categoria;
import jpa.model.Cliente;
import jpa.model.Departamento;
import jpa.model.Endereco;
import jpa.model.Entrega;
import jpa.model.Fornecedor;
import jpa.model.Item;
import jpa.model.NotaFiscal;
import jpa.model.Produto;

public abstract class DAOFactory {

	public static final int JDBC = 1;

	public static final int JPA = 2;

	public abstract <T> T openConnection();

	public abstract <T> void closeConnection(T connection);

	public abstract <T> T getFactory();

	public abstract DAO<Cliente> getClienteDAO();

	public abstract DAO<Categoria> getCategoriaDAO();

	public abstract DAO<Fornecedor> getFornecedorDAO();

	public abstract DAO<Produto> getProdutoDAO();

	public abstract DAO<Item> getItemDAO();

	public abstract DAO<NotaFiscal> getNotaFiscalDAO();

	public abstract DAO<Departamento> getDepartamentoDAO();

	public abstract DAO<Endereco> getEnderecoDAO();

	public abstract DAO<Entrega> getEntregaDAO();

	public static DAOFactory getDAOfactory(int factoryType) {
		switch (factoryType) {
		case 2:
			return JPADAOFactory.getInstance();

		default:
			return null;
		}
	}

}
